package com.project.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.InventoryManagement.AgentiaBean;
import com.project.service.IAgentiaService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("agt")
public class AgentiaController {


    @Resource
    private IAgentiaService agentiaService;


    @RequestMapping("findCutAgentia")
    public IPage<AgentiaBean> findCutAgentia(@RequestParam(value = "pageNo",defaultValue = "1") int pageNo, @RequestParam(value = "pageSize",defaultValue = "3") int pageSize, String agentiaName, String agentiaType, String agentiaCategory) {


        IPage<AgentiaBean> page = agentiaService.findCutAgentia(pageNo,pageSize,agentiaName,agentiaType,agentiaCategory);

        return page;
    }


    @RequestMapping("addAgentia")
    public String addAgentia(AgentiaBean agentiaBean) {

        if (agentiaBean != null){
            agentiaService.addAgentia(agentiaBean);
        }

        return "ok";
    }
}
